#include "Filter.h"

Filter::Filter(void)
{
}

Filter::~Filter(void)
{

}

unsigned int Filter::getId()
{
	return this->id;
}

void Filter::setId(unsigned int id)
{
	this->id = id;
}

const Patient* Filter::getPatient()const
{
	return this->patient;
}

void Filter::setPatient(const Patient* p)
{
	this->patient = p;
}

QString Filter::getName()const
{
	return name;
}

void Filter::setName(const QString& name)
{
	this->name = name;
}

bool Filter::isDefault()
{
	return this->is_default;
}

void Filter::setDefault(bool def)
{
	this->is_default = def;
}

QDate Filter::getFrom()const
{
	return this->from;
}

void Filter::setFrom(QDate from)
{
	this->from = from;
}

QDate Filter::getTo()const
{
	return this->to;
}

void Filter::setTo(QDate to)
{
	this->to = to;
}

bool Filter::isFirstVisits()const
{
	return this->onlyFirstVisits;
}

void Filter::setFirstVisits(bool b)
{
	this->onlyFirstVisits = b;
}

bool Filter::isLastVisits()const
{
	return this->onlyLastVisits;
}

void Filter::setLastVisits(bool b)
{
	this->onlyLastVisits = b;
}

bool Filter::isOnlyFollowUps()const
{
	return onlyFollowUps;
}

void Filter::setOnlyFollowUps(bool b)
{
	onlyFollowUps = b;
}

bool Filter::operator <=(const Filter &filter)const
{
	if(this == &filter) return true;
	bool ret = false;
	if(this->getFrom() < filter.getFrom())
		return ret;
	if(this->getTo() > filter.getTo())
		return ret;
	if(this->getPatient() != filter.getPatient())
		return ret;
	if(!this->isFirstVisits() && filter.isFirstVisits())
		return ret;
	if(!this-isLastVisits() && filter.isLastVisits())
		return ret;
	if(!this->isOnlyFollowUps() && filter.isOnlyFollowUps())
		return ret;
	return true;
}